package com.banciyuan.bcywebview.biz.main.mineinfo.zan;

import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.banciyuan.bcywebview.R;
import com.banciyuan.bcywebview.base.activity.BaseActivity;
import com.banciyuan.bcywebview.base.helper.ActionbarHelper;

/**
 * Created by squall on 2017/4/26.
 */

public class GetZanActivity extends BaseActivity {

    private TextView zan_num;
    private TextView over_num;
    private String rank;
    private int count;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_getzan);
        initArgs();
        initActionbar();
        initUi();
    }

    @Override
    protected void initArgs() {
        count = getIntent().getIntExtra("count", 0);
        rank = getIntent().getStringExtra("rank");
    }

    @Override
    protected void initUi() {
        zan_num = (TextView) findViewById(R.id.zan_num);
        over_num = (TextView) findViewById(R.id.over_num);
        zan_num.setText(String.valueOf(count));
        if (count == 0) {
            over_num.setVisibility(View.GONE);
        } else {
            over_num.setVisibility(View.VISIBLE);
            if (!TextUtils.isEmpty(rank)) {
                over_num.setText(Html.fromHtml(String.format(getString(R.string.over_friends), rank + "%")));
            } else {
                over_num.setText(getString(R.string.unlock_zan));
            }
        }
    }

    @Override
    protected void initActionbar() {
        View mActionBarView = findViewById(R.id.base_action_bar);
        ActionbarHelper mActionbarHelper = new ActionbarHelper(this, mActionBarView);
        mActionbarHelper.setTitle(getString(R.string.mine_zan));
    }
}
